<?php
require_once 'libs/auth.class.php';
require_once 'libs/mysql.class.php';
require_once 'libs/menu.class.php';

$conn = new Mysql();
$auth = new Auth();

if ( !$auth->is_connected() ) {
	header('Location: login.php');
	exit();
}

require_once 'libs/Twig/Autoloader.php';
Twig_Autoloader::register();

$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
		/*'cache' => '/path/to/compilation_cache',*/
));

$tplVars = array();

$tplVars['username'] = 'Esther';

$tplVars['jsFiles'] = array(
    'bootstrap/js/jquery.min.js',
    'bootstrap/js/excanvas.min.js', 
    'bootstrap/js/jquery.ui.custom.js', 
    'bootstrap/js/bootstrap.min.js', 
    'bootstrap/js/jquery.flot.min.js', 
    'bootstrap/js/jquery.flot.resize.min.js', 
    'bootstrap/js/jquery.peity.min.js', 
    'bootstrap/js/fullcalendar.min.js', 
    'bootstrap/js/unicorn.js', 
    'bootstrap/js/unicorn.dashboard.js', 
);

$menu = new Menu();
$menu->setCurrentMenu('Accueil');
$tplVars['menus']     = $menu->getMenu();
$tplVars['curr_menu'] = $menu->getCurrentMenu();

echo $twig->render('index.twig', $tplVars);